<template>
    <div class="spare-subclass-page">
        <el-form :inline="true" :model="subclassForm" class="demo-form-inline" style="border-bottom:1px solid #ccc;">
            <!--备件编码-->
            <el-form-item :label="nowLangue.beijian+nowLangue.code" class="selectMB10">
                <el-input size="mini" v-model="subclassForm.code" :placeholder="nowLangue.pleaseImport+nowLangue.beijian+nowLangue.code"></el-input>
            </el-form-item>
            <!--备件名称-->
            <el-form-item :label="nowLangue.beijian+nowLangue.name" class="selectMB10">
                <el-input size="mini" v-model="subclassForm.name" :placeholder="nowLangue.pleaseImport+nowLangue.beijian+nowLangue.name"></el-input>
            </el-form-item>
            <!--当前状态-->
             <el-form-item :label="nowLangue.currentState" class="selectMB10">
                <el-select size="mini" clearable v-model="subclassForm.status" :placeholder="nowLangue.pleaseSelect" style="width:90px;" >
                    <el-option v-for="(status,index) in statusLists" :key="index" :label="status.label" :value="status.value"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item class="selectMB10">
                <!--查询-->
                <el-button class="bolder outsideBtnBS selectAll" :disabled="selectDisabled" size="mini" type="danger" @click="querySubclssSheet()" v-text="nowLangue.query"></el-button>
            </el-form-item>
        </el-form>
        <!--表格-->
        <!--备件小类明细：-->
        <label class="default-label" v-text="nowLangue.beijian+nowLangue.detailed"></label>
        <!--新增按钮-->
        <!--新增-->
        <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="createNew()" v-text="nowLangue.create"></el-button>

        <el-table :data="subclassData" border style="width: 100%;" v-loading.body="loading" element-loading-text="拼命加载中">
            <!--序-->
            <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence"  width="40"></el-table-column>
            <!--操作-->
            <el-table-column :label="nowLangue.operate" header-align="center" align="center" width="80">
                <template scope="scope">
                    <!--禁用-->
                    <div class="operationItem bolder" v-if="scope.row.status" @click="handleStatus(scope.$index,scope.row)" v-text="nowLangue.forbidden"></div>
                    <!--启用-->
                    <div class="operationItem bolder" v-else @click="handleStatus(scope.$index,scope.row)" v-text="nowLangue.enable"></div>
                    <!--修改-->
                    <div class="operationItem disabled bolder" v-if="scope.row.status" v-text="nowLangue.update"></div>
                    <!--修改-->
                    <div class="operationItem bolder" v-else @click="updateCorFact(scope.$index,scope.row)" v-text="nowLangue.update"></div>
                </template>
            </el-table-column>
            <!--备件小类编码-->
            <el-table-column prop="bjCode" :label="nowLangue.beijian+nowLangue.bjCode" header-align="center" align="center"  show-overflow-tooltip></el-table-column>
            <!--备件小类名称-->
            <el-table-column prop="bjName" :label="nowLangue.beijian+nowLangue.name" header-align="center" align="center"  show-overflow-tooltip></el-table-column>
            <!--当前状态-->
            <el-table-column prop="ststusName" :label="nowLangue.status" header-align="center" align="center"  show-overflow-tooltip></el-table-column>
            <!--描述-->
            <el-table-column prop="name" :label="nowLangue.xiaolei" header-align="center" align="center"  show-overflow-tooltip></el-table-column>
            <el-table-column prop="dname" :label="nowLangue.dalei" header-align="center" align="center"  show-overflow-tooltip></el-table-column>
            <el-table-column prop="legalPersonName" :label="nowLangue.legalPersonName" header-align="center"  show-overflow-tooltip></el-table-column>


           <!-- <el-table-column prop="version"  header-align="center" show-overflow-tooltip></el-table-column>-->


        </el-table>
        <!--分页-->
        <el-pagination v-if="isPaging" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageIndex"  :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :page-count="totalPage" :total="totalNumber"></el-pagination>
         <!--新建弹窗-->
        <!--新增备件小类信息-->
        <el-dialog :title="nowLangue.create+nowLangue.beijian" :visible.sync="dialogForm1Visible" size="tiny" :lock-scroll="false">
            <el-form :inline="true" :model="addSpareSubclassForm" class="demo-form-inline label-minW120" style="border-bottom:1px solid #ccc;" ref="addSpareSubclassForm">
                <!--备件小类编码-->
                <el-form-item :label="nowLangue.beijian+nowLangue.code" prop="bjCode"   >
                    <el-input  v-model.trim="addSpareSubclassForm.bjCode" :placeholder="nowLangue.pleaseImport+nowLangue.spareSubClass+nowLangue.code"></el-input>
                </el-form-item>
                <!--备件小类名称-->
                <el-form-item :label="nowLangue.beijian+nowLangue.name" prop="bjName"  >
                    <el-input  v-model.trim="addSpareSubclassForm.bjName" :placeholder="nowLangue.pleaseImport+nowLangue.beijian+nowLangue.name"></el-input>
                </el-form-item>
               <!-- &lt;!&ndash;备件小类描述&ndash;&gt;
                <el-form-item :label="nowLangue.beijian+nowLangue.description" >
                    <el-input  v-model="addSpareSubclassForm.remark" :placeholder="nowLangue.pleaseImport+nowLangue.spareSubClass+nowLangue.description"></el-input>
                </el-form-item>-->

                <!--备件小类-->
                <el-form-item :label="nowLangue.xiaolei" prop="name"  >
                    <el-select size="mini" clearable  v-model="addSpareSubclassForm.name" :placeholder="nowLangue.pleaseSelect">
                        <el-option v-for="(legalPerson,index) in legalPersonDropDown" :key="index" :label="legalPerson.name" :value="legalPerson.xid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <!--计划大类-->
                <el-form-item :label="nowLangue.dalei" prop="dname"   >
                    <el-select size="mini" clearable  v-model="addSpareSubclassForm.dname" :placeholder="nowLangue.pleaseSelect">
                        <el-option v-for="(legalPerson,index) in legalPersonDropDown1" :key="index" :label="legalPerson.dname" :value="legalPerson.did">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="法人名称" :label-width="labelWidth" class="b-attribute" >
                    <el-checkbox-group v-model="addSpareSubclassForm.legalPersonCode">
                        <el-checkbox v-for="(wareHouseBA,index) in wareHouseBALists" :key="index" :label="wareHouseBA.legalPersonCode" >{{wareHouseBA.legalPersonName}}</el-checkbox>
                    </el-checkbox-group>
                </el-form-item>

                <!--状态-->
                <el-form-item :label="nowLangue.status"  >
                    <el-radio-group v-model="addSpareSubclassForm.status">
                        <!-- 启用 -->
                        <el-radio :label="true" v-cloak>{{nowLangue.enable}}</el-radio>
                        <!-- 禁用 -->
                        <el-radio :label="false" v-cloak>{{nowLangue.forbidden}}</el-radio>
                    </el-radio-group>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <!--保存-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="saveSpareSubclass" v-text="nowLangue.save" :disabled="saveSSDisabled"></el-button>
                <!--取消-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="cancelSpareSubclass" v-text="nowLangue.cancel"></el-button>
            </div>
        </el-dialog>
        <!--修改弹窗-->
        <!--修改备件小类信息-->
        <el-dialog :title="nowLangue.update+nowLangue.beijian" :visible.sync="dialogForm2Visible" size="tiny" :lock-scroll="false">
            <el-form :inline="true" :model="updateSpareSubclassForm" class="demo-form-inline label-minW120" style="border-bottom:1px solid #ccc;" ref="updateSpareSubclassForm">
                <!--备件小类编码-->
                <el-form-item :label="nowLangue.beijian+nowLangue.cpde" prop="bjCode"   >
                    <el-input  v-model.trim="updateSpareSubclassForm.bjCode" disabled></el-input>
                </el-form-item>
                <!--备件小类名称-->
                <el-form-item :label="nowLangue.beijian+nowLangue.name" prop="bjName">
                    <el-input  v-model.trim="updateSpareSubclassForm.bjName" :title="updateSpareSubclassForm.bjName"></el-input>
                </el-form-item>

                <!--备件小类-->
                <el-form-item :label="nowLangue.xiaolei" prop="name"  >
                    <el-select size="mini" clearable  v-model="updateSpareSubclassForm.name" :placeholder="nowLangue.pleaseSelect">
                        <el-option v-for="(legalPerson,index) in legalPersonDropDown" :key="index" :label="legalPerson.name" :value="legalPerson.name">
                        </el-option>
                    </el-select>
                </el-form-item>

                <!--计划大类-->
                <el-form-item :label="nowLangue.dalei" prop="dname"   >
                    <el-select size="mini" clearable  v-model="updateSpareSubclassForm.dname" :placeholder="nowLangue.pleaseSelect">
                        <el-option v-for="(legalPerson,index) in legalPersonDropDown1" :key="index" :label="legalPerson.dname" :value="legalPerson.dname">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="法人信息" :label-width="labelWidth" class="b-attribute">
                    <el-checkbox-group v-model="updateSpareSubclassForm.legalPersonVO">
                        <el-checkbox v-for="(wareHouseBA,index) in wareHouseBALists" :key="wareHouseBA.legalPersonCode" :label="wareHouseBA.legalPersonName" disabled></el-checkbox>
                    </el-checkbox-group>
                </el-form-item>

               <!-- <el-form-item label="法人信息" :label-width="labelWidth" class="b-attribute">
                    <el-checkbox-group v-model="updateSpareSubclassForm.legalPersonVO" @change="selectedWareHouseBA">
                        <el-checkbox v-for="(wareHouseBA,index) in wareHouseBALists" :key="wareHouseBA.legalPersonCode" :label="wareHouseBA.legalPersonName"></el-checkbox>
                    </el-checkbox-group>
                </el-form-item>-->
                <!--状态-->
                <el-form-item :label="nowLangue.status" >
                    <el-radio-group v-model="updateSpareSubclassForm.status">
                        <!-- 启用 -->
                        <el-radio :label="true" v-cloak>{{nowLangue.enable}}</el-radio>
                        <!-- 禁用 -->
                        <el-radio :label="false" v-cloak>{{nowLangue.forbidden}}</el-radio>
                    </el-radio-group>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <!--保存-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="saveUpdateSpareSubclass" v-text="nowLangue.save" :disabled="saveUSSDisabled"></el-button>
                <!--取消-->
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="cancleUpdateSubclass" v-text="nowLangue.cancel"></el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
       export default {
        data() {
            return {
                nowLangue:{},
                language:{
                    zh:{
                        "pleaseSelect":"请选择",
                        "pleaseImport":"请输入",
                        "query":"查询",
                        "code":"编码",
                        "detailed":"查询",
                        "name":"名称",
                        "beijian":"备件",
                        "xiaolei":"备件小类",
                        "dalei":"计划大类",
                        "legalPersonName":"法人名称",
                        "currentState":"当前状态",
                        "spareSubClass":"备件小类",
                        "parameterName":"参数名称",
                        "spareParameterList":"备件参数明细",
                        "create":"新增",
                        "sequence":"序",
                        "operate":"操作",
                        "forbidden":"禁用",
                        "enable":"启用",
                        "update":"修改",
                        "parameterType":"参数类型",
                        "paramterUnit":"参数单位",
                        "founder":"创建人",
                        "creationTime":"创建时间",
                        "modifier":"修改人",
                        "modificationTime":"修改时间",
                        "parameterValue":"参数值",
                        "spareParameterValue":"备件参数值",
                        "status":"状态",
                        "save":"保存",
                        "cancel":"取消",
                        "sure":"确定",
                    },
                    en:{
                        "pleaseSelect":"please Select",
                        "pleaseImport":"please Import",
                        "query":"query",
                        "spareSubClass":"spare SubClass",
                        "parameterName":"parameter Name",
                        "spareParameterList":"spare Parameter List",
                        "create":"create",
                        "sequence":"sequence",
                        "operate":"operate",
                        "forbidden":"forbidden",
                        "enable":"enable",
                        "update":"update",
                        "parameterType":"parameter Type",
                        "paramterUnit":"paramter Unit",
                        "founder":"founder",
                        "creationTime":"creation Time",
                        "modifier":"modifier",
                        "modificationTime":"modification Time",
                        "parameterValue":"parameter Value",
                        "spareParameterValue":"spare Parameter Value",
                        "status":"status",
                        "save":"save",
                        "cancel":"cancel",
                        "sure":"sure",

                    }
                },
                // 查询表单
                subclassForm:{
                    name:"",
//                    bid:"",
                    code:"",
                    legalPersonName:"",
                    status:"",
                    remark:""
                },
                statusLists:[],   //当前状态下拉列表
                labelWidth:"100px",
                addSpareSubclassForm:{
                    name:"",

                    code:"",
                    status:false,
                    subClassId:"",
                    categoryId:"",
                    fid:[],
                    planClassId:"",
                    dname:"",
                    legalPersonCode:[],
                    legalPersonName:[]
                },
                updateSpareSubclassForm:{
                    name:"",
                    dname:"",
                    code:"",
                    legalPersonCode:[],
                    legalPersonName:[],
                    wareHouseBADropDown:[],
                    legalPersonCode:[],
                    legalPersonVO:[],
                    status:false,
//                    subClassId:"",
//                    categoryId:"",
//                    planClassId:"",
                    version:0  //verion版本控制
                },
                wareHouseBALists:[],   // 库区业务属性下拉列表
                subclassData:[],
                loading:false,
                disabled:false,


                //弹窗
                dialogForm1Visible:false,
                dialogForm2Visible:false,
                // 分页
                isPaging:false,
                pageIndex:1,    //当前页（必传）
                pageSize :10,   //每页多少条
                totalNumber: 20,
                totalPage:2,
                
                //查询禁用
                selectDisabled:false,
                saveSSDisabled:false,    //新增弹窗中保存操作按钮的禁用
                saveUSSDisabled:false   //修改弹窗中保存操作按钮的禁用
            };
        },
        created:function(){
            var _this=this;
            _this.languageType=="zh"?_this.nowLangue=_this.language.zh:_this.nowLangue=_this.language.en;
        },
        computed:{
            // powerData(){
            //     return this.$store.state.powerData;
            // },
            languageType(){
                return this.$store.state.languageType;
            }
        },
        watch:{
            languageType(){
                var _this=this;
                _this.languageType=="zh"?_this.nowLangue=_this.language.zh:_this.nowLangue=_this.language.en;
            }
        },
       //进入页面立即运行此方法
       mounted: function () {
            var _this = this;
            _this.$store.commit('currentActive', 'SpareSubclass');
            // //ajax前后查询按钮禁用
            // $(".selectAll").ajaxStart(function(){
            //     _this.selectDisabled=true;
            // });
            // $(".selectAll").ajaxStop(function(){
            //     _this.selectDisabled=false;
            // });
            _this.dropDownValue();// 当前状态下拉列表
           _this.legalPersonDropDownValue();//备件小类下拉框
           _this.legalPersonDropDownValued();//备件小类下拉框
           _this.querySubclssSheet();    //表单查询
           _this.wareHouseBADropDown();   // 法人多选框
       },
        methods:{
            // 库区业务属性下拉列表
            wareHouseBADropDown(){
                var _this = this;
                $.ajax({
                    type:'GET',
                    url:_this.procurement_service+'legalPerson/ofCurrentUser',
                    cache:false,
                    // data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType:"application/json;charset=utf-8",
                    success:function(data){
                        if(data.success){
                            _this.wareHouseBALists=data.data;
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                })
            },

            //法人名称下拉列表值
            legalPersonDropDownValue(){
                var _this = this;
                $.ajax({
                    type:'GET',
                    url:_this.procurement_service+"subClass/queryAll",
                    cache:false,
                    success:function(data){
                        if(data.success){
                            _this.legalPersonDropDown = data.data;
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                })
            },
            //大类名称下拉列表值
            legalPersonDropDownValued(){
                var _this = this;
                $.ajax({
                    type:'GET',
                    url:_this.procurement_service+"subClass/queryAlld",
                    cache:false,
                    success:function(data){
                        if(data.success){
                            _this.legalPersonDropDown1 = data.data;
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                })
            },
            // 当前状态下来列表
            dropDownValue(){
                var _this=this;
                var tmp=["subClass.subClassStatus"];
                $.ajax({
                    type:'POST',
                    url:_this.metadata_service+'metadata/getPullDownList',
                    cache:false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType:"application/json;charset=utf-8",
                    success:function(data){
                        if(data.success){
                            _this.statusLists=data.data;
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                })
            },
            //查询列表
            querySubclssSheet(){
                var _this=this;
                _this.loading=true;
                var tmp={
                    name:_this.subclassForm.name,
                    name:_this.subclassForm.name,
                    code:_this.subclassForm.code,
                    status:_this.subclassForm.status,
                    pageIndex:_this.pageIndex,
                    pageSize:_this.pageSize
                };
                _this.selectDisabled=true;
                $.ajax({
                    type: 'POST',
                    url: _this.metadata_service+"part/queryB",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            _this.loading=false;
                            _this.isPaging=true;
                            _this.totalPage=data.data.totalPage;
                            _this.totalNumber=data.data.totalNumber;
                            _this.subclassData=data.data.dataList;
                        }else{
                            _this.common.errorTip(data.errorMessage)
                        }
                        _this.selectDisabled=false;
                    }
                });
            },
            //新增税码税率信息
            createNew(){
                var _this=this;
                _this.dialogForm1Visible=true; 
                if(this.$refs['addSpareSubclassForm']) {
                    this.$refs['addSpareSubclassForm'].resetFields();
                }
                _this.addSpareSubclassForm.name="";
                _this.addSpareSubclassForm.code="";
                _this.addSpareSubclassForm.status=false;
                _this.addSpareSubclassForm.remark="";
            },
            //新建保存
            saveSpareSubclass(){
                var _this=this;
                _this.$refs["addSpareSubclassForm"].validate((valid) => {
                    if (valid) {
                        var tmp={
                            bjName:_this.addSpareSubclassForm.bjName,   //去除税码两边的空格
                            bjCode:_this.addSpareSubclassForm.bjCode,
                            status:_this.addSpareSubclassForm.status,
                            name:_this.addSpareSubclassForm.name,
//                            legalPersonName:_this.addSpareSubclassForm.legalPersonName,
                            subClassId:_this.addSpareSubclassForm.subClassId,
                            dname:_this.addSpareSubclassForm.dname,
                            fids:_this.addSpareSubclassForm.fid,
                            categoryId:_this.addSpareSubclassForm.categoryId,
                            legalPersonCode:_this.addSpareSubclassForm.legalPersonCode

                        };
                        _this.saveSSDisabled=true;
                        $.ajax({
                            type: 'POST',
                            url: _this.procurement_service+"subClass/addb",
                            cache: false,
                            data:JSON.stringify(tmp),
                            dataType:'JSON',
                            contentType: "application/json;charset=utf-8",
                            success: function (data) {
                                if (data.success) {
                                    var success=_this.languageType=="zh"?'保存成功':'Save Success';
                                    _this.common.successTip(success);
                                    _this.dialogForm1Visible=false;
                                    _this.querySubclssSheet();
                                }else{
                                    _this.common.errorTip(data.errorMessage);
                                }
                                _this.saveSSDisabled=false;
                            }
                        });
                    } else {
                        var  err=_this.common.formErrorInfo();
                        _this.common.errorTip(err);
                        return false;
                    }
                });
            },
            //新建取消
            cancelSpareSubclass(){
                var _this=this;
                _this.dialogForm1Visible=false;
                if(this.$refs['addSpareSubclassForm']) {
                    this.$refs['addSpareSubclassForm'].resetFields();
                }
                _this.addSpareSubclassForm.bjName="";
                _this.addSpareSubclassForm.bjCode="";
                _this.addSpareSubclassForm.name="";
                _this.addSpareSubclassForm.fid="";
                _this.addSpareSubclassForm.dname="";
                _this.addSpareSubclassForm.status=false;

            },
            // 操作启用禁用
            handleStatus(index, row){
                var _this=this;
                if(row.status){
                    row.status = false;
                }else{
                    row.status = true;
                }
                var tmp={id: row.id,status: row.status}; 
                $.ajax({
                    type: 'POST',
                    url:_this.procurement_service+"subClass/updateStatusB",
                    cache: false,
                    data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            // 当前状态的显示
                            if(row.status){
                                row.statusName = "启用";
                                var success=_this.languageType=="zh"?'启用成功':'Enable success';
                                _this.common.successTip(success);
                            }else{
                                row.statusName = "禁用";
                                var success=_this.languageType=="zh"?'禁用成功':'Disable success';
                                _this.common.successTip(success);
                            }
                        }else
                            _this.common.errorTip(data.errorMessage);
                    }
                });
            },

            //点击修改
            updateCorFact(index,row){
                var _this=this;
                _this.dialogForm2Visible=true;
                _this.handleGetData(row.id);
                if(this.$refs['updateSpareSubclassForm']) {
                    this.$refs['updateSpareSubclassForm'].resetFields();
                 }
                _this.updateSpareSubclassForm.id = row.id;
                 _this.updateSpareSubclassForm.bjName = row.bjName;
                 _this.updateSpareSubclassForm.bjCode = row.bjCode;
                 _this.updateSpareSubclassForm.name = row.name;
                 _this.updateSpareSubclassForm.dname = row.dname;
                 _this.updateSpareSubclassForm.legalPersonName = row.legalPersonName;
            },
            // 修改查看取值
            handleGetData(id){
                var _this = this;
                $.ajax({
                    url:'http://127.0.0.1:18082/part/queryById?id='+id,
                    type:'GET',
                    cache:false,
                    // data:JSON.stringify(tmp),
                    dataType:'JSON',
                    contentType:'application/json;charset=utf-8',
                    success:function(data){
                        if(data.success){
                            var bAArr = data.data.legalPersonList;
                            var tmpBA = [];
                            // 库区业务属性
                            for(var i=0;i<bAArr.length;i++){
                                tmpBA.push(bAArr[i].legalPersonName);
                            }
//                            if(_this.dialogForm2Visible){
                                _this.updateSpareSubclassForm = data.data;
//                                _this.updateSpareSubclassForm = data.data;
                                _this.updateSpareSubclassForm.legalPersonVO = tmpBA;
                                _this.seedWareHouseBA(tmpBA);   // 库区业务属性
//                            }
                           /* if(_this.dialogForm3Visible){
                                _this.seeWarehouseAreaForm = data.data;
                                _this.seeWarehouseAreaForm.businessAttribute = tmpBA;
                            }*/
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                })

            },
            //新增弹窗中 选择库区业务属性
            selectedWareHouseBA(value){
                var _this = this;
                _this.seedWareHouseBA(value);
            },
            // 库区业务属性
            seedWareHouseBA(value){
                var _this = this;
                var businessAttributeValue=[],selectedValue=[];
                for(var i=0;i<value.length;i++){
                    for(var j=0;j<_this.wareHouseBALists.length;j++){
                        if(value[i] == _this.wareHouseBALists[j].legalPersonName){
                            businessAttributeValue.push(_this.wareHouseBALists[j].legalPersonCode);
                        }
                    }
                }
               for(var k=0;k<businessAttributeValue.length;k++){
                    selectedValue.push({
                        legalPersonVO:businessAttributeValue[k]
                    });
                }
//                if(_this.dialogForm1Visible){
//                    _this.addWarehouseAreaForm.checkedBusinessAttribute = selectedValue;
//                }else if(_this.dialogForm2Visible){
                    _this.updateSpareSubclassForm.legalPersonVO = selectedValue;
//                }
            },
            //修改保存
            saveUpdateSpareSubclass(){
                var _this=this;
                _this.$refs["updateSpareSubclassForm"].validate((valid) => {
                    if (valid) {
                        var tmp={
                            bid:_this.updateSpareSubclassForm.bid,
                            xid:_this.updateSpareSubclassForm.xid,
                            did:_this.updateSpareSubclassForm.did,
                            name:_this.updateSpareSubclassForm.name,
                            dname:_this.updateSpareSubclassForm.dname,
                            bjCode:_this.updateSpareSubclassForm.bjCode,
                            legalPersonCode:_this.updateSpareSubclassForm.legalPersonCode,
                            bjName:_this.updateSpareSubclassForm.bjName,
                            status: _this.updateSpareSubclassForm.status,
                            remark:_this.updateSpareSubclassForm.remark,
                            version:_this.updateSpareSubclassForm.version//verion版本控制
                        };
                        _this.saveUSSDisabled=true;
                        $.ajax({
                            type: 'POST',
                            url: _this.procurement_service+"/subClass/updateB",
                            cache: false,
                            data:JSON.stringify(tmp),
                            dataType:'JSON',
                            contentType: "application/json;charset=utf-8",
                            success: function (data) {
                                if (data.success) {
                                    var success=_this.languageType=="zh"?'修改成功！':'Modify successfully';
                                    _this.common.successTip(success);
                                    _this.dialogForm2Visible=false;
                                    _this.querySubclssSheet();
                                }else{
                                    _this.common.errorTip(data.errorMessage);
                                }
                                _this.saveUSSDisabled=false;    
                            }
                        });
                    } else {
                        var  err=_this.common.formErrorInfo();
                        _this.common.errorTip(err);
                        return false;
                    }
                });
            },
            //修改取消
            cancleUpdateSubclass(){
                var _this=this;
                _this.dialogForm2Visible=false;
            },
            //   分页
            handleSizeChange(val) {
                var _this=this;
                _this.pageSize=val;
                _this.querySubclssSheet();

            },
            //点击页码分页查询点击事件
            handleCurrentChange(val) {
                var _this=this;
                _this.pageIndex=val;
                _this.querySubclssSheet();
            }
        }
    }
</script>
